﻿using System.ComponentModel;

namespace HeritageAcademy.Shared
{
    /// <summary>
    /// A base class for all data (aka "model" classes) that implements INotifyPropertyChanged.
    /// Our ViewModel will rely on property change notifications taking in place in the underlying
    /// model in order to propagate changes to the UI. Not every MVVM scenario allows you to 
    /// implement INotifyPropertyChanged in the model, but since we are implementing our model from
    /// scratch we have the opportunity to do this and makes the rest of our code much cleaner.
    /// </summary>
    public class ModelBase : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        protected void RaisePropertyChanged(string name)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(name));
        }
    }
}